$(function() {
	$('#vue_vm_list div').hide();
});

var behalfElectricity = {
	behalfElectricityId: '',
	elderId: '',
	year: '',
	month: '',
	rent: '',
	payWay: '',
	createTime: '',
	updateTime: '',
	createId: getLoginedUser()? getLoginedUser().staffId: '',
	updateId: getLoginedUser()? getLoginedUser().staffId: '',
	subjectRoomId: getLoginedUser().subjectRoomId,
	subjectRoomName: getLoginedUser().subjectRoomName
};

var view = {
	data: behalfElectricity
};

var vue_vm = new Vue({
	el: '#vue_vm',
	data: view
});

function save() {
	view.data.year = (view.data.year==''? 0: parseInt(view.data.year));
	view.data.month = (view.data.month==''? 0: parseInt(view.data.month));
	view.data.rent = (view.data.rent==''? 0: parseFloat(view.data.rent));
	view.data.payWay = (view.data.payWay==''? 0: parseInt(view.data.payWay));

	save_basic(path+'/behalfElectricity/save', {behalfElectricity:view.data}, function() {
		alert('保存成功');
		window.open('6-2-6jdiangfei-1.html?behalfElectricityId=' + view.data.behalfElectricityId);
	});
}

function findAll() {
	if($('#vue_vm_list').length==0) {return;}
	$('#vue_vm_list div').hide();

	findAll_basic(path+'/behalfElectricity/findAll', function(response) {
		$('#vue_vm_list').html(gl_vue_vm_list_html);
		
		new Vue({
			el: '#vue_vm_list',
			data: {
				todos: response.data
			}
		});
		
		$('#vue_vm_list div').show();
	});
}

function deleteBatch() {
	deleteBatch_basic(path+'/behalfElectricity/deleteBatch');
}
